﻿using System;
using System.Collections.Generic;

namespace Mbs.Messaging
{
    public interface IMessageRepository : IEnumerable<KeyValuePair<Key, ISubject>>,IDisposable
    {
        string Name { get; set; }

        ISubjectBuilder Builder { get; }
        IMessageListnerManager ListnerManager { get; }
        IDelegateInvoker DelegateInvoker { get; }

        bool ContainSubject(Type type);
        bool ContainSubject(string topic, Type type);
        bool ContainSubject<T>();
        bool ContainSubject<T>(string topic);

        ISubject this[Type type] { get; }
        ISubject this[string topic, Type type] { get; }
        ISubject<TMessage> Subject<TMessage>();
        ISubject<Topic<TMessage>> Subject<TMessage>(string topic);

        void RegisterSubject(string topic, Type type, ISubject subject);

        void Remove<TMessage>();
        void Remove<TMessage>(string topic);
        void Remove(Type type);
        void Remove(string topic, Type type);

        int Count { get; }
        void Clear();

    }
}
